package ex.com.jm.food.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
 * 城市
 * @author Administrator
 *
 */
@Entity
@Table(name="jm_citys")
public class Citys implements Serializable {

	
	private static final long serialVersionUID = 1L;
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name="ctiy_id",nullable=false,unique=true,length=11)
	 private int cityId;
	 @Column(name="ctiy_name",nullable=false,unique=true,length=32)
	 private String cityName;
	 @ManyToOne
	 @JoinColumn(name="pro_id")
	 private Province proId;
	 @OneToMany(mappedBy="cityId",fetch=FetchType.EAGER)
	 private Set<Countys> countys=new HashSet<Countys>();
	public int getCityId() {
		return cityId;
	}
	public void setCityId(int cityId) {
		this.cityId = cityId;
	}
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	public Province getProId() {
		return proId;
	}
	public void setProId(Province proId) {
		this.proId = proId;
	}
	public Set<Countys> getCountys() {
		return countys;
	}
	public void setCountys(Set<Countys> countys) {
		this.countys = countys;
	}
}
